define(function(require){

	var $ = require('jquery');
	var url = document.location.href;
	
	
	/* user */
	if(url.match(/(\/user\/)[-a-zA-Z0-9]{0,62}(\/team)+/g)){
		$('#user-course-nav a').each(function(){
			$(this).removeClass('btn-primary');
		});
		$('#user-course-team').removeClass('btn-link');
		$('#user-course-team').addClass('btn-primary');
	}
	if(url.match(/(\/user\/)[-a-zA-Z0-9]{0,62}(\/decision)+/g)){
		$('#user-course-nav a').each(function(){
			$(this).removeClass('btn-primary');
		});
		$('#user-course-decision').removeClass('btn-link');
		$('#user-course-decision').addClass('btn-primary');
	}
	if(url.match(/(\/user\/)[-a-zA-Z0-9]{0,62}(\/report)+/g) 
			|| url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/param)+/g) 
			|| url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/delete)+/g) ){
		$('#user-course-nav a').each(function(){
			$(this).removeClass('btn-primary');
		});
		$('#user-course-report').removeClass('btn-link');
		$('#user-course-report').addClass('btn-primary');
		
	}
	
	/* user profile*/
	if(url.match(/(\/user\/message)+/g)){
		$('#user-message').addClass('active');
	}
	if(url.match(/(\/user\/profile)+/g)){
		$('#user-profile').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/user/profile"))=="/user/profile"){
		$('#user-profile-index').addClass('active');
	}
	if(url.match(/(\/user\/profile\/avatar)+/g)){
		$('#user-profile-avatar').addClass('active');
	}
	if(url.match(/(\/user\/profile\/password)+/g)){
		$('#user-profile-password').addClass('active');
	}
	if(url.match(/(\/user\/profile\/message)+/g)){
		$('#user-profile-message').addClass('active');
	}
	
	
	/* decision */
	if(url.indexOf('/team/background') != -1){
		$('#team-background').addClass('active');
	}
	if(url.indexOf('/team/member') != -1){
		$('#team-member').addClass('active');
	}
	if(url.indexOf('/team/strategy') != -1){
		$('#team-strategy').addClass('active');
	}
	if(url.indexOf('/team/finance') != -1){
		$('#team-finance').addClass('active');
	}
	if(url.indexOf('/team/direction') != -1){
		$('#team-direction').addClass('active');
	}
	
	/* decision */
	if(url.indexOf('/decision/start') != -1){
		$('#decision-start').addClass('active');
	}
	if(url.indexOf('/decision/check') != -1){
		$('#decision-check').addClass('active');
	}
	if(url.indexOf('/decision/plan') != -1){
		$('#decision-plan').addClass('active');
	}
	if(url.indexOf('/decision/tech') != -1){
		$('#decision-tech').addClass('active');
	}
	if(url.indexOf('/decision/market') != -1){
		$('#decision-market').addClass('active');
	}
	if(url.indexOf('/decision/produce') != -1){
		$('#decision-produce').addClass('active');
	}
	if(url.indexOf('/decision/finance') != -1){
		$('#decision-finance').addClass('active');
	}
	
	/* report */
	if(url.indexOf('/report/finance') != -1){
		$('#report-finance').addClass('active');
	}
	if(url.indexOf('/report/market') != -1){
		$('#report-market').addClass('active');
	}
	if(url.indexOf('/report/cost') != -1){
		$('#report-cost').addClass('active');
	}
	if(url.indexOf('/report/operation') != -1){
		$('#report-operation').addClass('active');
	}
	if(url.indexOf('/report/ioperation') != -1){
		$('#report-ioperation').addClass('active');
	}
	if(url.indexOf('/report/ifinance') != -1){
		$('#report-ifinance').addClass('active');
	}
	if(url.indexOf('/report/imarket') != -1){
		$('#report-imarket').addClass('active');
	}
	
	
	/* teach */
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/team)+/g)){
		$('#teach-course-nav a').each(function(){
			$(this).removeClass('btn-primary');
		});
		$('#teach-course-team').removeClass('btn-link');
		$('#teach-course-team').addClass('btn-primary');
	}
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/\d)+/g)){
		$('#teach-course-nav a').each(function(){
			$(this).removeClass('btn-primary');
		});
		$('#teach-course-round').removeClass('btn-link');
		$('#teach-course-round').addClass('btn-primary');
	}
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/setting)+/g) 
			|| url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/param)+/g) 
			|| url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/delete)+/g) ){
		$('#teach-course-nav a').each(function(){
			$(this).removeClass('btn-primary');
		});
		$('#teach-course-setting').removeClass('btn-link');
		$('#teach-course-setting').addClass('btn-primary');
		
	}
	
	/* teach course new*/
	if(url.match(/(\/teach\/course\/new)+/g)){
		$('#teach-course-new').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/teach/course/new"))=="/teach/course/new"){
		$('#teach-course-new-index').addClass('active');
	}
	
	/* teach profile*/
	if(url.match(/(\/teach\/message)+/g)){
		$('#teach-message').addClass('active');
	}
	if(url.match(/(\/teach\/profile)+/g)){
		$('#teach-profile').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/teach/profile"))=="/teach/profile"){
		$('#teach-profile-index').addClass('active');
	}
	if(url.match(/(\/teach\/profile\/avatar)+/g)){
		$('#teach-profile-avatar').addClass('active');
	}
	if(url.match(/(\/teach\/profile\/password)+/g)){
		$('#teach-profile-password').addClass('active');
	}
	if(url.match(/(\/teach\/profile\/message)+/g)){
		$('#teach-profile-message').addClass('active');
	}
	
	/* teach course round*/
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/\d)+/g)){
		$('#teach-course-round-index').addClass('active');
	}
	if(url.match(/(\/teach\/)[-a-z-A-Z0-9]{0,62}(\/\d+\/)param/g)){
		$('#teach-course-round-nav li').each(function(){
			$(this).removeClass('active');
		});
		$('#teach-course-round-param').addClass('active');
	}
	if(url.match(/(\/teach\/)[-a-z-A-Z0-9]{0,62}(\/\d+\/)setting/g)){
		$('#teach-course-round-nav li').each(function(){
			$(this).removeClass('active');
		});
		$('#teach-course-round-setting').addClass('active');
	}
	if(url.match(/(\/teach\/)[-a-z-A-Z0-9]{0,62}(\/\d+\/)sale/g)){
		$('#teach-course-round-nav li').each(function(){
			$(this).removeClass('active');
		});
		$('#teach-course-round-sale').addClass('active');
	}

	/* teach course setting*/
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/setting)+/g)){
		$('#teach-course-setting-index').addClass('active');
	}
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/setting\/round)+/g)){
		$('#teach-course-setting-nav li').each(function(){
			$(this).removeClass('active');
		});
		$('#teach-course-setting-round').addClass('active');
	}
	if(url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/delete)+/g)){
		$('#teach-course-delete').addClass('active');
	}
	
	
	/* admin setting begin*/
	/* admin header */
	if(url.match(/(\/admin\/account)+/g)){
		$('#admin-account').addClass('active');
	}
	if(url.match(/(\/admin\/course)+/g)){
		$('#admin-course').addClass('active');
	}
	if(url.match(/(\/admin\/model)+/g)){
		$('#admin-model').addClass('active');
	}
	if(url.match(/(\/admin\/system)+/g)){
		$('#admin-system').addClass('active');
	}
	if(url.match(/(\/admin\/profile)+/g)){
		$('#admin-profile').addClass('active');
	}
	
	/* admin account*/
	if(url.match(/(\/admin\/account)+/g)){
		$('#admin-account').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/account"))=="/admin/account"){
		$('#admin-account-index').addClass('active');
	}
	if(url.match(/(\/admin\/account\/user)+/g)){
		$('#admin-account-user').addClass('active');
	}
	
	/* admin course*/
	if(url.match(/(\/admin\/course)+/g)){
		$('#admin-course').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/course"))=="/admin/course"){
		$('#admin-course-index').addClass('active');
	}
	if(url.match(/(\/admin\/course\/review)+/g)){
		$('#admin-course-review').addClass('active');
	}
	if(url.match(/(\/admin\/course\/prepare)+/g)){
		$('#admin-course-prepare').addClass('active');
	}
	if(url.match(/(\/admin\/course\/underway)+/g)){
		$('#admin-course-underway').addClass('active');
	}
	
	/* admin model*/
	if(url.match(/(\/admin\/model)+/g)){
		$('#admin-model').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/model"))=="/admin/model"){
		$('#admin-model-index').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/model/review"))=="/admin/model/review"){
		$('#admin-model-review').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/model/open"))=="/admin/model/open"){
		$('#admin-model-open').addClass('active');
	}
	if(url.match(/(\/admin\/model\/new)+/g)){
		$('#admin-model-new').addClass('active');
	}
	
	/* admin system*/
	if(url.match(/(\/admin\/system)+/g)){
		$('#admin-system').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/system"))=="/admin/system"){
		$('#admin-system-site').addClass('active');
	}
	if(url.match(/(\/admin\/system\/guide)+/g)){
		$('#admin-system-guide').addClass('active');
	}
	if(url.match(/(\/admin\/system\/position)+/g)){
		$('#admin-system-position').addClass('active');
	}
	
	/* admin profile*/
	if(url.match(/(\/admin\/profile)+/g)){
		$('#admin-profile').addClass('active');
	}
	if(url.substring(url.lastIndexOf("/admin/profile"))=="/admin/profile"){
		$('#admin-profile-index').addClass('active');
	}
	if(url.match(/(\/admin\/profile\/password)+/g)){
		$('#admin-profile-password').addClass('active');
	}
	
	
	
});